package com.YHVision.qiuzhike.model.vo;

import cn.hutool.json.JSONUtil;
import com.YHVision.qiuzhike.model.entity.CompanyQuestion;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 企业问题关联视图
 *
 * @author <a href="">YHVision-小y</a>
 * @from <a href="todo">爱编程学习圈</a>
 */
@Data
public class CompanyQuestionVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 企业 id
     */
    private Long companyId;

    /**
     * 题目 id
     */
    private Long questionId;

    /**
     * 创建用户信息
     */
    private UserVO user;

    /**
     * 封装类转对象
     *
     * @param companyQuestionVO
     * @return
     */
    public static CompanyQuestion voToObj(CompanyQuestionVO companyQuestionVO) {
        if (companyQuestionVO == null) {
            return null;
        }
        CompanyQuestion companyQuestion = new CompanyQuestion();
        BeanUtils.copyProperties(companyQuestionVO, companyQuestion);
        return companyQuestion;
    }

    /**
     * 对象转封装类
     *
     * @param companyQuestion
     * @return
     */
    public static CompanyQuestionVO objToVo(CompanyQuestion companyQuestion) {
        if (companyQuestion == null) {
            return null;
        }
        CompanyQuestionVO companyQuestionVO = new CompanyQuestionVO();
        BeanUtils.copyProperties(companyQuestion, companyQuestionVO);
        return companyQuestionVO;
    }
}
